package com.egao.orderB.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
import com.egao.orderB.biz.MaintainFeeOceanBiz;
import com.egao.orderB.entity.MaintainFeeOcean;
import com.egao.orderB.service.MaintainFeeOceanService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//import com.egao.orderB.mapper.MaintainFeeOceanMapper;
//import javax.transaction.Transactional;

/**
 * 海运附加费维护服务实现类
 * @author : Doman
 * @date : 2020-12-24 16:05:18
 * @version ：1.0
 */
@Service
public class MaintainFeeOceanServiceImpl /*extends ServiceImpl<MaintainFeeOceanMapper, MaintainFeeOcean> */implements MaintainFeeOceanService {

	@Autowired
	private MaintainFeeOceanBiz maintainFeeOceanBiz;

    /**
    @Override
    public PageResult<MaintainFeeOcean> listPage(PageParam<MaintainFeeOcean> page) {
        List<MaintainFeeOcean> records = baseMapper.listPage(page);
        return new PageResult<>(records, page.getTotal());
    }

    @Override
    public List<MaintainFeeOcean> listAll(Map<String, Object> page) {
        return baseMapper.listAll(page);
    } */

    @Override
    public JsonResult list(PageResult2<T> page, MaintainFeeOcean maintainFeeOcean, User loginUser)  throws Exception{
        return maintainFeeOceanBiz.list(page,maintainFeeOcean,loginUser);
    }

    @Override
    public JsonResult list(MaintainFeeOcean maintainFeeOcean, User loginUser) {
        return JsonResult.ok().setData(maintainFeeOceanBiz.list(maintainFeeOcean,loginUser));
    }

    @Override
    public JsonResult getById(MaintainFeeOcean maintainFeeOcean) {
        return JsonResult.ok().setData(maintainFeeOceanBiz.getById(maintainFeeOcean));
    }

    @Override
    public JsonResult save(MaintainFeeOcean maintainFeeOcean, User loginUser) {
        if (maintainFeeOceanBiz.save(maintainFeeOcean, loginUser)) {
            return JsonResult.ok("添加成功");
        }
        return JsonResult.error("添加失败");
    }

    @Override
    public JsonResult update(MaintainFeeOcean maintainFeeOcean, User loginUser) {
        if (maintainFeeOceanBiz.update(maintainFeeOcean, loginUser)) {
            return JsonResult.ok("修改成功");
        }
        return JsonResult.error("修改失败");
    }

    @Override
    public JsonResult remove(MaintainFeeOcean maintainFeeOcean, User loginUser) {
        if (maintainFeeOceanBiz.remove(maintainFeeOcean, loginUser)) {
            return JsonResult.ok("删除成功");
        }
        return JsonResult.error("删除失败");
    }

}
